﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RentAWorker.WebNew.Customer
{
    public partial class WorkerSearchResults : System.Web.UI.UserControl
    {
        private Dictionary<string, string> Parameters;

        public void UpdateDataSource(Dictionary<string, string> parameters)
        {
            Parameters = parameters;
            WorkerDataSource.Select();
            WorkersListView.DataBind();
        }

        protected void WorkerDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            if (Parameters == null)
            {
                e.Cancel = true;
                return;
            }
            
            foreach (var parameter in Parameters.Keys)
            {
                e.InputParameters[parameter] = Parameters[parameter] ?? string.Empty;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}